<template>
  <el-table :data="tableData" border style="width: 100%">
    <el-table-column prop="member_Id" label="会员编号" width="180" />
    <el-table-column prop="member_Name" label="会员名称" width="180" />
    <el-table-column prop="member_Phone" label="手机号" width="180" />
    <el-table-column prop="member_IdCard" label="身份证号" width="180" />
    <el-table-column prop="member_BirthDay" label="出生日期" width="180" />
    <el-table-column prop="member_Gender" label="性别" width="180" />
    <el-table-column prop="member_State" label="状态" width="180" />
    <el-table-column prop="role_Name" label="角色名称" width="180" />
    <el-table-column label="操作" width="180">
      <template #default="scope">
        <el-button type="primary" @click="EditInfo(scope.row.member_Id)">编辑</el-button>
      </template>
    </el-table-column>
  </el-table>
</template>

<script lang="ts" setup>
import axios from 'axios';
import {onMounted, ref} from  'vue'
import {useRouter} from 'vue-router'

const router=useRouter();
const tableData = ref();

onMounted(()=>{
LoadData();
})

const LoadData=()=>{
  axios.get('api/Members/GetMembersList')
  .then(res=>{
    tableData.value=res.data.data;
  })
}

const EditInfo=(id:number)=>{
  router.push({
    name:"EditMember",
    params:{
      mID:id
    }
  });
}
</script>
